#!/bin/bash

getopt -Qn 'Error' hm:p:t: "$@"
if [ $# -eq 0 ];
then echo usage: reset_partition -m [\"managed system\"] -p [\"partition name\"] -t [reset type]
exit 1
fi
if [ $1 = '-h' ];
then echo
echo usage: reset_partition -m [\"managed system\"] -p [\"partition name\"] -t [reset type]
echo '     ' reset a partition on the managed system
echo '     ' NOTE: If the partition name is the same as the managed system, this is taken
echo '           ' as a request to reset the managed system itself.
echo
echo Options:
echo '   ' -m the name of the managed system enclosed enclosed in double quotes \" \"
echo '   ' -p the name of the partition to be reset enclosed in double quotes \" \"
echo '   ' -t the reset type
echo '   ' -h brings up this help screen
echo reset type:
echo '   ' hard - issue a Hard Reset
echo '   ' soft - issue a Soft Reset, similar to an operating system reset
echo
exit 0
fi

if [ "${DEBUG_JARS_DIRECTORY}" != "" ] ; then
  if [ -d ${DEBUG_JARS_DIRECTORY} ] ; then
    for i in ${DEBUG_JARS_DIRECTORY}/*.jar
    do
       debug_jars=${debug_jars}:$i
    done
  fi
fi

export CLASSPATH=${DEBUG_JARS_DIRECTORY}:${debug_jars}:/usr/websm/codebase/pluginjars/hsc.jar:/usr/websm/codebase/pluginjars/sniacimom.jar:/usr/websm/codebase/pluginjars/xerces.jar:/usr/websm/codebase/pluginjars/HwmcaCommon.jar:/usr/websm/codebase/pluginjars/auifw.jar:$CLASSPATH
export PATH=/opt/IBMJava2-13/jre/bin:$PATH

if [ $# -eq 6 ];
then java -Djavax.net.ssl.keyStore=/usr/websm/codebase/SM.pubkr -Djavax.net.ssl.keyStorePassword=defp -Dorg.snia.wbem.cimom.properties=/opt/hsc/data/cim.properties com.ibm.hsc.common.util.ResetPartition "\"$2\"" "\"$4\"" $6
exit 0
fi
echo usage: reset_partition -m [\"managed system\"] -p [\"partition name\"] -t [reset type]
exit 1

